#ifndef SHEET_H
#define SHEET_H

class Entry;
class Cell;
class Sheet;


enum CellType{
	CT_ID,		//I
	CT_INT,		//N
	CT_FLOAT,	//F
	CT_STR,		//S
};
class EntryIter
{
public:
	virtual ~EntryIter(){}
	virtual bool Next() = 0;
	virtual void Release() = 0;
	virtual Entry* GetEntry() = 0;

	virtual bool operator==(const EntryIter& rhs) = 0;
	virtual bool operator!=(const EntryIter& rhs) = 0;
};


class Sheet
{
public:
	virtual ~Sheet(){}
	virtual Entry*		GetEntry(int id)				= 0;
	virtual int			GetType(int column)				= 0;
	virtual const char*	GetTitle(int column)			= 0;
	virtual int			GetColumn(const char* title)	= 0;
	virtual int			GetColumnCount()				= 0;
	virtual int			GetIDColumn()					= 0;

public:
	virtual EntryIter*	GetFirst()	= 0;
	virtual EntryIter*	GetLast()	= 0;

};

class CellIter
{
public:
	virtual ~CellIter(){}
	virtual bool Next() = 0;
	virtual void Release() = 0;

	virtual Cell* GetCell() = 0;

	virtual bool operator==(const CellIter& rhs) = 0;
	virtual bool operator!=(const CellIter& rhs) = 0;
};
class Entry
{
public:
	virtual ~Entry(){}
	virtual Cell*	GetCell(int column)			= 0;
	virtual Cell*	GetCell(const char* title)	= 0;
	virtual Cell*	GetIDCell()					= 0;
	virtual Sheet*	GetSheet()					= 0;
	virtual int		GetID()						= 0;

public:
	virtual CellIter*	GetFirst()	= 0;
	virtual CellIter*	GetLast()	= 0;
	
};
class Cell
{
public:
	
	virtual ~Cell(){}	
	virtual int			toInt()		= 0;
	virtual float		toFloat()	= 0;
	virtual const char*	toStr()		= 0;
	virtual Entry*		GetEntry()	= 0;
	virtual Sheet*		GetSheet()	= 0;
	virtual int			GetType()	= 0;
	virtual int			GetColumn()	= 0;
};



Sheet* LoadSheet(const char* filename, const char* sheetname = 0);

#endif 